#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:3.1-alpine AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:3.1-alpine AS build
WORKDIR /src
COPY ["HiStore.WebApi/HiStore.WebApi.csproj", "HiStore.WebApi/"]
RUN ls -l
COPY ["HiStore.Auth/HiStore.Auth.csproj", "HiStore.Auth/"]
RUN ls
COPY ["HiStore.Cache/HiStore.Cache.csproj", "HiStore.Cache/"]
COPY ["HiStore.Configuration/HiStore.Configuration.csproj", "HiStore.Configuration/"]
COPY ["HiStore.Core/HiStore.Core.csproj", "HiStore.Core/"]
COPY ["HiStore.Model/HiStore.Model.csproj", "HiStore.Model/"]
COPY ["HiStore.Util/HiStore.Util.csproj", "HiStore.Util/"]
COPY ["HiStore.Filter/HiStore.Filter.csproj", "HiStore.Filter/"]
COPY ["HiStore.IRepository/HiStore.IRepository.csproj", "HiStore.IRepository/"]
COPY ["HiStore.IServices/HiStore.IServices.csproj", "HiStore.IServices/"]
COPY ["HiStore.Mapper/HiStore.Mapper.csproj", "HiStore.Mapper/"]
COPY ["HiStore.Repository/HiStore.Repository.csproj", "HiStore.Repository/"]
COPY ["HiStore.Services/HiStore.Services.csproj", "HiStore.Services/"]
RUN dotnet restore "HiStore.WebApi/HiStore.WebApi.csproj"
COPY . .
WORKDIR "/src/HiStore.WebApi"
RUN ls
RUN dotnet build "HiStore.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "HiStore.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
RUN ls
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HiStore.WebApi.dll"]
